package decisionalalgorithms.guialgorithms.converters;

import decisionalalgorithms.guialgorithms.commands.ResultsCommand;
import decisionalalgorithms.guialgorithms.domain.Results;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class ResultsCommandToResults implements Converter<ResultsCommand, Results> {
    @Override
    public Results convert(ResultsCommand source) {
        if (source == null) {
            return null;
        }
        final Results results = new Results();
        results.setId(source.getId());
        results.setAlgorithm(source.getAlgorithm());
        results.setResult(source.getResult());
        return results;
    }
}
